import 'dart:convert';

class MapResponse {
  int code;
  String msg;
  Map<String, dynamic> data;

  MapResponse(this.code, this.msg, this.data);

  factory MapResponse.fromJson(Map<String, dynamic> data) {
    return MapResponse(
      data['code'],
      data['msg'],
      data['data'] == '' ? {} : data['data'],
    );
  }

  Map<String, dynamic> toMap() {
    return {
      'code': code,
      'msg': msg,
      'data': data,
    };
  }

  @override
  String toString() {
    return json.encode(toMap());
  }
}
